<?php
/**
 * @copyright  For copyright and license information, read the COPYING.txt file.
 * @link       /COPYING.txt
 * @license    Academic Free License (AFL 3.0)
 * @package     base_default
 */
?>
<?php
/** @var Mage_GoogleAnalytics_Block_Ga $this */
$_helper = $this->helper('googleanalytics');
?>
<?php if (!$this->helper('core/cookie')->isUserNotAllowSaveCookie()): ?>
    <?php if ($_helper->isUseAnalytics4()): ?>
        <?php $_gaAccountId = $_helper->getAccountId() ?>
        <!-- BEGIN GOOGLE ANALYTICS 4 CODE -->
        <script async src="https://www.googletagmanager.com/gtag/js?id=<?= $_gaAccountId ?>"></script>
        <script>
            window.dataLayer = window.dataLayer || [];
            function gtag(){dataLayer.push(arguments);}
            <?php echo $this->_getPageTrackingCode($_gaAccountId) ?>
            <?php echo $this->_getEnhancedEcommerceDataForAnalytics4() ?>
        </script>
        <!-- END GOOGLE ANALYTICS 4 CODE -->
    <?php endif ?>
<?php endif ?>
